# -*- coding:utf-8 -*-
__author__ = 'Ren Yuan'
'''
测试动态合成文本远程调用的client
'''


import sys
import Ice
Ice.loadSlice('LesComposer.ice')
import LESComposer
import imagedata
from pprint import pprint


class Client(Ice.Application):

    def run(self, args):
        if len(args) > 1:
            print('{0}: too many arguments'.format(self.appName))
            return 1

        #获得ComposeTextService代理
        compose_text_prx = LESComposer.ComposeTextServicePrx.checkedCast(
            self.communicator().propertyToProxy('ComposeTextService.Proxy'))

        if not compose_text_prx:
            print('Invalid compose_text_prx')
            return -1

        #构建测试数据
        test_seq_image = imagedata.Image_info_data()
        test_seq_image_info = test_seq_image.get_seq_image_info()
        compose_text = compose_text_prx.getComposeString(test_seq_image_info)
        pprint(compose_text)

        return 1


app = Client()
sys.exit(app.main(sys.argv, 'config.client'))
